package com.combat.text.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.combat.text.user.entity.user;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface userMapper extends BaseMapper<user> {

    @Select("select * from user where uno = #{uno}  and  upassword  =  #{upassword} ")
    user find(int uno, int upassword);

    @Select("select * from user limit #{start} , #{limit}")
    List<Map<String,Object>>  select(int start, int limit);


    @Update("UPDATE user set uno = #{uno} , uname = #{uname} , sex = #{sex} , adress = #{adress} , " +
            " post = #{post} ,postid = #{postid} , upassword = #{upassword} , sal = #{sal} where uno = #{uno}")
    int updateuser(user u);

    @Select("SELECT *  from user WHERE uno =#{uno}")
    List<user>  finduser(int uno);


    @Insert("insert into user(uno,uname,sex,adress,post,postid,upassword,sal) values (#{uno},#{uname},#{sex},#{adress},#{post},#{postid},#{upassword},#{sal})")
    int save(user u);

    @Delete("DELETE from user WHERE uno =#{uno}")
    int deleteuser(int uno);

    @Select("select * from user where uno = #{search} limit #{start} , #{limit}")
    List<Map<String,Object>>  findshow(int start, int limit, String search);
}
